__author__ = 'nameoff'

import httplib2
import feedparser


def GetDirectLink(link):
    h = httplib2.Http()

    custom_headers = {
        'Referer':'http://www.torrentino.com/torrents/%s' % link[link.find("/",1)+1:len(link)],
        'Host':'www.torrentino.com'
    }

    response, content = h.request('http://www.torrentino.com/torrents/%s/download' % link[link.find("/",1)+1:len(link)],"GET", headers=custom_headers)

    return (response['content-location'])

def GetTweets():
	h = httplib2.Http()
	
	response, content = h.request("http://search.twitter.com/search.atom?q=from:TorentulProject")
	
	data = feedparser.parse(content)
	
	for item in data.entries:
		item.imagelink = item.links[1].href
	
	return data.entriesz